<!DOCTYPE html>
<html>
<head>
<script src=../../resources/js-test.js language="javascript" type="text/javascript"></script>
<title>Testing that searching for text restarts at the last active match.</title>
</head>
<body>
    <div id="container">
        Failure: If the second search ends up finding the text in this line we didn't restart the search from the last active match: last_step.<br />
        Start: The first search should match this word: first_step.<br />
        Success: The second search should match this word: last_step. Subsequent searches should fail.
    </div>
<pre id="console" style="visibility: hidden;"></pre>
<script>
function log(message)
{
    document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}

if (!window.testRunner)
    testFailed('This test requires the testRunner object');
else {
    shouldBeTrue('testRunner.findString("first_", [])');
    shouldBeTrue('testRunner.findString("first_step", ["StartInSelection"])');
    shouldBeTrue('testRunner.findString("last_step", [])');
    shouldBeFalse('testRunner.findString("last_step", [])');
    shouldBeTrue('testRunner.findString("last_step", ["WrapAround"])');
}

document.getElementById("console").style.removeProperty("visibility");

var successfullyParsed = true;
</script>
</body>
</html>
